/**
 * 1 实例化 hook ，定义 _x = [fn1, fn2, ... ]， taps = [{}, {} ... ]
 * 2 实例调用 tap taps = [{}, {}, ...]
 * 3 调用 call 方法， HookCodeFactory setup create
 * 4 Hook SyncHook HookCodeFactory
 */

// SyncHook
/*const SyncHook = require('./SyncHook.js')

let hook = new SyncHook(['name', 'age'])

hook.tap('fn1', function (name, age) {
    console.log('fn1----->', name, age)
})

hook.tap('fn2', function (name, age) {
    console.log('fn2----->', name, age)
})

hook.call('SeaChan', 18)*/


// AsyncParallelHook
const AsyncParallelHook = require('./AsyncParallelHook.js')

const hook = new AsyncParallelHook(['name', 'age', 'qwe'])

hook.tapAsync('fn1', function (name, age, qwe, callback) {
    console.log('fn1----->', name, age, qwe)
    callback()
})

hook.tapAsync('fn2', function (name, age, qwe, callback) {
    console.log('fn2----->', name, age, qwe)
    callback()
})

hook.callAsync('SeaChan', 18, 123, function () {
    console.log('end')
})
